package com.ruoyi.task;

import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.constants.BusinessConstants;
import com.ruoyi.develop.finance.financeInvoiceReceipt.domain.FinanceInvoiceReceipt;
import com.ruoyi.develop.finance.financeInvoiceReceipt.service.IFinanceInvoiceReceiptService;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 定时任务
 *
 * @author lmm
 */
@Component("autoWriteOffTask")
public class AutoWriteOffTask {


    public static IFinanceInvoiceReceiptService financeInvoiceReceiptService = SpringUtils.getBean(IFinanceInvoiceReceiptService.class);



    // 自动核销 发票
    public void autoWriteOff() {

        // 查询 未核销的发票
        FinanceInvoiceReceipt financeInvoiceReceipt = new FinanceInvoiceReceipt();
        financeInvoiceReceipt.setStatus(BusinessConstants.INVOICE_RECEIPT_STATUS_UN);
        List<FinanceInvoiceReceipt> receiptList = financeInvoiceReceiptService.selectList(financeInvoiceReceipt);

        for (FinanceInvoiceReceipt receipt : receiptList) {
            financeInvoiceReceiptService.autoWriteOff(receipt);
        }

    }























}
